package com.android.fitcontrol.setting;

import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceActivity;

import com.android.fitcontrol.R;
import com.android.fitcontrol.common.CommonUtils;

/**
 * Main layout setting.
 * 
 * @author rduboveckiy
 * @version 1.5
 */
public class MainSettingActivity extends PreferenceActivity{
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		addPreferencesFromResource(R.xml.preferences);
 
		ListPreference listLanguage = (ListPreference) findPreference("listLanguage");
		
		listLanguage.setOnPreferenceChangeListener(new OnPreferenceChangeListener(){
			public boolean onPreferenceChange(Preference preference,
					Object newValue) {
				CommonUtils.setLocale(newValue.toString(), getBaseContext());
				return true;
			}
		});
	}
}
